//轮播图

let imglist=$("#imgbox li");
let ul=$("#imgbox");
let n=0;

function changeimg(){
    ul.animate({
        marginLeft:-(n*1920)
    })
}
//单击切换
$("#right").click(function(){
    if(n<imglist.length-1){
        n++;
    }
    else{
        n=0;
    }
    changeimg()
})
$(".tijiao").click(function(){
    let http = new XMLHttpRequest()
			http.open("get",`http://127.0.0.1:8080/cha?username=${$("#username").val()}&userpass=${$("#userpass").val()}&tel=${$("#tel").val()}`)
			http.send()
			http.onreadystatechange = function(){
				if(http.readyState === 4){
                    console.log(http.responseText)
					if(http.responseText === "success"){
						alert("注册新用户成功，点击去登录");
						location.href = "http://127.0.0.1/west-point/src/login.html";
					}
					if(http.responseText === "error"){
						alert("注册失败")
					}
				}
			} 
      })